﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace TestVisioCanvas.Converters
{
    class EnumNameConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {            
            Models.MasterCategory cat = (Models.MasterCategory)value;
            switch (cat)
            {                                
                case TestVisioCanvas.Models.MasterCategory.Walls:
                    return "Elementi Mura";
                case TestVisioCanvas.Models.MasterCategory.Doors:
                    return "Porte e finestre";
                case TestVisioCanvas.Models.MasterCategory.Furniture:
                    return "Mobili";
                case TestVisioCanvas.Models.MasterCategory.Eletronics:
                    return "Elettrodomestici";
                case TestVisioCanvas.Models.MasterCategory.Sanitary:
                    return "Sanitari";
                case Models.MasterCategory.Measures :
                    return "Misure";
                case TestVisioCanvas.Models.MasterCategory.Other:
                    return "Altro";
                default:
                    throw new Exception("Imposssible Case") ;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    class MarginValueConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var Margin = (System.Windows.Thickness)value;
            double Vratio = (System.Windows.SystemParameters.FullPrimaryScreenHeight / 900);
            double Hratio = (System.Windows.SystemParameters.FullPrimaryScreenWidth / 1440);
            System.Diagnostics.Debug.WriteLine(Vratio);
            System.Diagnostics.Debug.WriteLine(Hratio);
            System.Diagnostics.Debugger.Break();
            System.Windows.Thickness t =
                new System.Windows.Thickness(Margin.Left * Hratio, Margin.Top * Vratio,
                    Margin.Right * Hratio, Margin.Bottom * Vratio);

            return t;

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    class WidthValueConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double val = (double)value;
            double Height = 14 * (System.Windows.SystemParameters.FullPrimaryScreenWidth / 1440);
            return Height;

        }


        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
